<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>
</head>
<body>
<button onclick="login()">点击登录</button>
<button onclick="shouye()">首页</button>
<script>
    function login(){
        $.ajax({
            url:"http://localhost:8080/setCookies",
            type:"GET",
            crossDomain: true,
            xhrFields: {
                withCredentials: true
            },
            success:function (data) {
                console.log(data);
            },
        });
    }
    function shouye(){
        $.ajax({
            url:"http://localhost:8080/getCookies",
            type:"GET",
            crossDomain: true,
            xhrFields: {
                withCredentials: true
            },
            success:function (data) {
                console.log(data);
            },
        });
    }

</script>
</script>
</body>
</html>